
var url_depatment = config.path + "/a/ed/edeBasicDepatment/app_GetDepatmentData";
var url_sub_disease = config.path + "/a/ed/edeBasicSubDisease/app_GetSubDiseaseData";

new Vue({
	el: '#app',
	data: {
		message: "Vue",
		active : 0,
		depts: [],
		subDisease: []
	},
	methods: {
		deptClick: function(idx, item) {
			var _this = this;
			this.active = idx;
			console.log(idx, item);
			$$.getJSON(url_sub_disease, {depatmentId: item.id}, function(data) {
				//console.log(data);
				if(data.status.index == 10000){
					_this.subDisease = data.results;
				}

			});
		},
		subDeptClick: function (item) {
			Akuma.choose(item.id, item.name);
		}
	},
	init: function () {
		var _this = this;
		$$.getJSON(url_depatment, {}, function(data) {
			//console.log(data);
			if(data.status.index == 10000){
				_this.depts = data.results;
				_default = data.results[0];
				$$.getJSON(url_sub_disease, {depatmentId: parseInt(_default.id)}, function(data) {
					//console.log(data);
					if(data.status.index == 10000){
						_this.subDisease = data.results;
					}

				});
			}

		})
	}
});